﻿<div style="width:100%;overflow:hidden;">
<div style="margin-left:1%;margin-top:5px;">
    <form method="get">
        <div style="float:left;">日期范围:&nbsp;&nbsp;</div>
        <div style="float:left;">
            <input class="liger-dateeditor" type="text" name="start" value="@DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd")" />
        </div>
        <div style="float:left;">~</div>
        <div style="float:left;"><input class="liger-dateeditor" type="text" name="end" value="@DateTime.Now.ToString("yyyy-MM-dd")" /></div>
        &nbsp;&nbsp;
        <input type="submit" value="查询" style="width:60px;"/>
    </form>    
</div>
<div id="grid" style="margin-left:1%;margin-top:10px;"></div>
</div>

<script type="text/javascript">
    var _window = {};

    _window.options = {
        /* grid */
        columns: [
            {
                name: 'flowname', display: '审批流程名称', width: 200,
                render: function (r) {
                    return '<a href="/Item/Info?id=' + r.id + '" target="_self">' + r.flowname + '</a>';
                }
            }
            , {
                name: 'state', display: '当前状态', width: 100,
                render: function (i) {
                    switch (i.state) {
                        case 1:
                            return '进行中';
                        case 2:
                            return '暂停';
                        case 3:
                            return '结束-通过';
                        case 4:
                            return '结束-未通过';
                        default:
                            return '已关闭';
                    }
                }
            }
            , { name: 'creationtime', display: '申请时间', width: 120 }
            , { name: 'updatedtime', display: '最后修改时间', width: 120 }
        ],
        toolbar: { items: [] }
    };

    _window.control = {
        grid: null
    };

    _window.grid = function () {
        _window.control.grid = $('#grid').ligerGrid({
            columns: _window.options.columns,
            resizable: false,
            frozen: false,
            height: '98%',
            width: '98%',
            rownumbers: true,
            dataAction: 'local'
        });

        @{
            string data = "var data = { Total: " + ViewBag.Total +
                ", Rows: " + ViewBag.Rows + "};";
        }
        @Html.Raw(data)

        _window.control.grid.loadData(data);
    }

    _window.init = function () {
        _window.grid();
    }

    /* ---------------------------------------------------------------------   */


    /* ---------------------------------------------------------------------   */
    $(document).ready(function () {
        _window.init();
    });
</script>